package com.touch.app.common.util;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class R {
    private Integer code;
    private String msg;
    private Object data;

    private R(){}

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
        this.data = null;
    }

    public R(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static R ok() {
        return new R(200,"success",null);
    }

    public static R ok(String msg) {
        return new R(200,msg,null);
    }

    public static R ok(String msg, Object data) {
        return new R(200,msg,data);
    }

    public static R error() {
        return new R(500,"error",null);
    }

    public static R error(String msg) {
        return new R(500,msg,null);
    }
    public static R error(String msg, Object data) {
        return new R(500,msg,data);
    }

}
